﻿<%@ page 
language="java" 
import="java.util.*" 
import="com.csd.helper.IConstant"
import="com.csd.helper.Tool"
import="com.csd.helper.ProjectState"
import="com.csd.vo.UserVO"
import="com.csd.pojo.Project"
import="com.csd.pojo.Team"
import="com.csd.pojo.DocumentRecord"
import="com.csd.local.IpAndHostName"
import="java.net.URLEncoder"
pageEncoding="UTF-8"
%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
System.out.println(basePath + "liu xinghua");
IpAndHostName ipAndHostName = new IpAndHostName();
String ip = ipAndHostName.getIp();
String encodeURL = URLEncoder.encode("http://swjx.scu.edu.cn:8001/rpms/userfile/upload/6/项目申请文档.pdf", "utf-8");
System.out.println(encodeURL + "liu xinghua");
String url = "http://docs.google.com/viewer?url=" + encodeURL;

System.out.println(url + "liu xinghua");
HttpSession s = request.getSession();
UserVO uvo =  (UserVO)s.getAttribute(IConstant.userVO);
if(uvo==null)
{
	response.sendRedirect(path);
}

Project curr_proj = (Project)request.getAttribute("project");
String stage = (String)request.getAttribute("stage");
if(stage == null || stage.length()==0)
{
	stage = request.getParameter("stage");
}
if(stage!=null && stage.equals("null"))
	stage = null;
String returnpage = (String)request.getAttribute("returnpage");
if(returnpage==null){
returnpage=new String("null");
}
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>项目细节</title>
<link href="<%=path %>/student/css/student_right.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <div class="main">
        <h1>项目细节</h1>
        <hr />
     <%if(curr_proj==null){%>
		<h3>对不起,暂时没有你的项目记录,你可能还没有申请任何项目!</h3>
	 <%}else{%>
        <table align="center" width="100%">
            <tr>
                <td class="form_strong">名称：</td>
                <td colspan="5"><%=curr_proj.getProjectname() %></td>
                <td class="form_strong">状态：</td>
                <td><%=curr_proj.getState() %></td>
            </tr>
            <tr>
                <td class="form_strong">类别：</td>
                <td><%=curr_proj.getProjectType().getName() %></td>
                <td class="form_strong">周期:</td>
                <td><%=curr_proj.getCycle() %></td>
                <td class="form_strong">研究领域：</td>
                <td><%=curr_proj.getResearchField().getName() %></td>
                <td class="form_strong">指导老师：</td>
                <td><%=curr_proj.getTeacher().getName() %></td>
            </tr>
            <tr>
            	<%Team team = curr_proj.getTeam(); %>
                <td class="form_strong">团队：</td>
                <td><%=team.getName() %></td>
                <td class="form_strong">负责人：</td>
                <td><%=team.getLeader().getName() %></td>
                <td class="form_strong">年级：</td>
                <td><%=team.getLeader().getGrade() %></td>
                <td class="form_strong">专业：</td>
                <td><%=team.getLeader().getMajor() %></td>
            </tr>
            <% Set<DocumentRecord> doc = curr_proj.getDocumentRecords(); %>
            <tr>
                <td class="form_strong">项目文档：</td>
                <td colspan="7">
                    <table width="100%">
                        <tr>
                            <td class="table_head">名称</td>
                            <td class="table_head" width="80px">阶段</td>
                            <td class="table_head" width="100px">最后修改</td>
                            <td class="table_head" width="50px">下载</td>
                            <td class="table_head" width="60px">在线查看</td>
                        </tr>
                        <% 
                        if(doc!=null)
                        {
                        	for( DocumentRecord item : doc )
                        	{
                        %>
                        <tr>
                            <td><%=item.getName() %></td>
                            <td><%=item.getStage() %></td>
                            <td><%=Tool.dateToString( item.getTime()) %></td>                            
                            <td>
                            	<form action="<%=path%>/fileDownload.action" method="post">
                            		<input type="hidden" name="path" value="<%=item.getPath() %>" />
                            		<%=item.getPath() %>
                            		<input type="submit" value=" 下载 " />
                            	</form>
                            </td>
                            <td>
                              <a href="http://docs.google.com/viewer?url=http://192.168.62.1:8080/swrpms/userfile/upload/19/applyDocument.pdf">查看</a>
                           
                            </td>
                        </tr>
                        <%	}
                        }else{ %>
	                        <tr>
	                            <td colspan="4" align="center">暂无</td>
	                        </tr>
						<%} %>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="table_head" colspan="8" align="left">项目简介：</td>
                <td>
                    <textarea id="introduction" name="introduction"  cols="50" rows="10" onblur="javascript:checkNotNull(this);" onkeydown="javascript:checkTextAreaLength(this, 0, 200);"><s:property value="project.introduction" /></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="8">
                	<%=curr_proj.getIntroduction() %>
                </td>
            </tr>
            <tr>
                <td colspan="8" align="right">
                    <a href="<%=path %>/teamInfoShow.action?teamID=<%=team.getId() %>&projectID=<%=curr_proj.getId() %>&stage=<%=stage %>&returnpage=<%=returnpage %>">查看团队组成</a>&nbsp;|&nbsp;
                    <a href="<%=path %>/costInfoShow.action?projectID=<%=curr_proj.getId() %>&stage=<%=stage %>&returnpage=<%=returnpage %>">查看费用开支</a>
                </td>
            </tr>
            <tr>
            	<td colspan="8" >
            		<table align="center" cellspacing="20px" cellpadding="10px">
            			<tr>

            <%
            	if( !(returnpage.equals("null")))
            	{
             %>
            	            			
                <td align="center"><a href="<%=path %>/common/sendMsg.jsp?receiverID=<%=IConstant.teamRole +  team.getId() %>">联系开发小组</a></td>
                	
                <td align="center"><a href="<%=returnpage %>">返回</a></td>
            <%
            	}
            	
            	String stat = curr_proj.getState();
            	
            	if(
	            	uvo.getType().equals(IConstant.teacherRole) &&
	            	(
	            		ProjectState.prophase.equals(stat) ||
	            		ProjectState.metaphase.equals(stat) ||
	            		ProjectState.finishCheck.equals(stat)
	            	)
            		)
            	{
					Integer eid = (Integer)request.getAttribute("evaluateItemID");
					if(eid != null){
             %>        
                <td align="center"><a href="<%=path%>/teacher/projectJudge.jsp?evaluateItemID=<%=eid%>">给出评分</a></td>
            <%
					}
            	}
            	
            	if( uvo.getType().equals(IConstant.managerRole) )
            	{
            		if(
            			ProjectState.apply.equals(stat) ||
	            		ProjectState.prophasePass.equals(stat) ||
	            		ProjectState.telophasePass.equals(stat)
            		)
            		{
             %>
                <td align="center">
                	<a href="evaluationTeacherList.action?stage=<%=stage %>&projectID=<%=curr_proj.getId() %>">分派评审</a>
                </td>
            <% 
            		}
            		
            		if(
            			ProjectState.prophase.equals(stat) ||
	            		ProjectState.finishCheck.equals(stat)
            		)
            		{
            %>
                <td align="center">
                	<a href="evaluateItemOfProject.action?stage=<%=stage %>&withAR=1&projectID=<%=curr_proj.getId() %>">录入成绩</a>               	
                </td>
            <%
                    }
            		
            		if(
            			ProjectState.metaphase.equals(stat)
            		)
            		{ 
            %>
                <td align="center">
              	    <a href="evaluateItemOfProject.action?stage=<%=stage %>&withAR=0&projectID=<%=curr_proj.getId() %>">录入成绩</a>   
                </td>
            <%
            		}
            	} 
            %>
                        </tr>
               		</table>
            	</td>
            </tr>
        </table>
       <%}%>
    </div>
</body>
</html>
